<?php
declare (strict_types=1);

namespace app\validate\admin;

use think\Validate;
use app\validate\BaseValidate;

class Role extends BaseValidate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'page' => 'require|integer|>:0',
        'status' => 'require|in:0,1',
        'name' => 'require',
        'id' => 'require|integer|>:0|isExist:Role',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [];

    protected $scene = [
        'index' => ['page'],
        'save' => ['name', 'status'],
        'update'=>['id','status','name'],
        'updateStatus'=>['id','status'],
        'delete'=>['id'],
        'setRules'=>['id']
    ];

}
